﻿package com.codingbros.countdown.model 
{
	import flash.utils.Timer
	
	/**
	 * ...
	 * @author peter@codingbros.com
	 */
	public class BasicModel implements IModel
	{
		private var titel:String = "Awesome sommerhus tur"
		private var setDate:Date;
		private var endDate:Date;
		
		public function BasicModel() 
		{
			
		}
		
		public function init():void 
		{
		}
		
		public function get countdownTitel():String 
		{
			return titel;
		}
		
		public function set countdownTitel(titel:String):void 
		{
			this.titel = titel;
		}
		
		
		public function get countdownSetDate():Date 
		{
			return setDate;
		}
		
		public function set countdownSetDate(date:Date):void
		{
			this.setDate = date;
		}
		
		
		public function get countdownEndDate():Date 
		{
			return endDate;
		}
		
		public function set countdownEndDate(date:Date):void
		{
			this.endDate = date;
		}
		
		
		public function get currentDate():Date
		{
			return new Date();
		}
		
		public function get timeRatio():Number
		{
			var setDateTime:Number = setDate.getTime();
			var endDateTime:Number = endDate.getTime();
			var currentDateTime:Number = new Date().getTime();
			
			var ratio:Number = (currentDateTime - setDateTime) / (endDateTime - setDateTime);
			trace("ratio = " + ratio);
			return ratio;
		}		
	}	
}